﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DateTimePicker.ascx.cs"
    Inherits="Control_DateTimePicker" %>

<script type="text/javascript" src="../DatePicker/WdatePicker.js"></script>

<script>
    function addHour() {
        var tbHour = document.getElementById('<%=tbHour.ClientID %>');
        var nowHour = parseInt(tbHour.value);
        if (nowHour == 23)
            tbHour.value = 0;
        else
            tbHour.value = nowHour + 1;
    }

    function subHour() {
        var tbHour = document.getElementById('<%=tbHour.ClientID %>');
        var nowHour = parseInt(tbHour.value);
        if (nowHour == 0)
            tbHour.value = 23;
        else
            tbHour.value = nowHour - 1;

    }

    function checkHourValue(num) {
        var hour = parseInt(num);
        if (hour > 23) {
            var tbHour = document.getElementById('<%=tbHour.ClientID %>');
            tbHour.value = "23";
        }

    }

    function addMinute() {
        var tbMinute = document.getElementById('<%=tbMinute.ClientID %>');
        var nowMinute = parseInt(tbMinute.value);
        if (nowMinute == 59)
            tbMinute.value = 0;
        else
            tbMinute.value = nowMinute + 1;
    }

    function subMinute() {
        var tbMinute = document.getElementById('<%=tbMinute.ClientID %>');
        var nowMinute = parseInt(tbMinute.value);
        if (nowMinute == 0)
            tbMinute.value = 59;
        else
            tbMinute.value = nowMinute - 1;

    }

    function checkMinuteValue(num) {
        var minute = parseInt(num);
        if (minute > 59) {
            var tbMinute = document.getElementById('<%=tbMinute.ClientID %>');
            tbMinute.value = "59";
        }

    }
</script>

<style>
    .setButton
    {
        width: 10px;
        height: 10px;
    }
    .Table04 .ClearTable
    {
        border-collapse: collapse;
    }
    .Table04 .ClearTable td
    {
        height: 1px;
        padding: 0px;
        margin: 0px;
    }
</style>
<table cellpadding="0" style="display: none;" cellspacing="1" border="0" class="ClearTable">
    <tr>
        <td rowspan="2" style="height: 1px">
        </td>
        <td rowspan="2" style="height: 1px">
            <asp:TextBox ID="tbHour" runat="server" CssClass="TextBox04" Width="20" MaxLength="2"
                onkeyup="this.value = this.value.replace(/[^0-9]/g, '');checkHourValue(this.value);"
                onfocus="this.select()"></asp:TextBox>
        </td>
        <td style="height: 1px">
            <input type="image" src="../Images/up.png" onclick="addHour();return false;" />
        </td>
        <td rowspan="2" style="height: 1px">
            <asp:TextBox ID="tbMinute" runat="server" CssClass="TextBox04" Width="20" MaxLength="2"
                onkeyup="this.value = this.value.replace(/[^0-9]/g, '');checkMinuteValue(this.value);"
                onfocus="this.select()"></asp:TextBox>
        </td>
        <td style="height: 1px">
            <input type="image" src="../Images/up.png" onclick="addMinute();return false;" />
        </td>
    </tr>
    <tr>
        <td style="height: 1px">
            <input type="image" src="../Images/down.png" onclick="subHour();return false;" />
        </td>
        <td style="height: 1px">
            <input type="image" src="../Images/down.png" onclick="subMinute();return false;" />
        </td>
    </tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" class="ClearTable">
    <tr>
        <td style="border:0 solid white;">
            <asp:TextBox ID="tbDate" runat="server" CssClass="TextBox01" Width="80" onfocus="WdatePicker();"></asp:TextBox>
            <asp:DropDownList ID="dropHour" runat="server" CssClass="TextBox01"></asp:DropDownList>时
            <asp:DropDownList ID="dropMin" runat="server" CssClass="TextBox01"></asp:DropDownList>分
        </td>
    </tr>
</table>
